import { BroadCastCall } from "../broadCast/BroadCastCall";
import { MessageBlock } from "../../../../Framework/MQ/MessageBlock";
import { SDrugBagInfo } from "../../../../Message/Game/SDrugBagInfo";
import { EDrug } from "../../../../Message/Public/EDrug";
import { NetDispatcher } from "../../../mvc/core/NetDispatcher";
import { ServerCommand } from "../../mvc/ServerCommand";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { DataEvent } from "../../events/DataEvent";
import { EventName } from "../../mvc/EventName";
//class DrugBagUpdateCommand
    
    export  class DrugBagUpdateCommand extends BroadCastCall
    {
        constructor(arg1: Object)
        {
            super(arg1);
            return;
        }

        public /* override */ call(arg1: MessageBlock): void
        {
            super.call(arg1);
            var loc1=arg1.messageBase as SDrugBagInfo;
            if (loc1) 
            {
                if (loc1.type != EDrug._EDrugLifeBag) 
                {
                    if (loc1.type == EDrug._EDrugManaBag) 
                    {
                        _cache.role.manaDrugBagInfo = loc1;
                    }
                }
                else 
                {
                    _cache.role.lifeDrugBagInfo = loc1;
                }
            }
            NetDispatcher.dispatchCmd(ServerCommand.DrugBagInfoUpdate, loc1);
            Dispatcher.dispatchEvent(new DataEvent(EventName.RoleAutoResume, null));
            return;
        }
    }
